#include "SapoFactory.h"

SapoFactory::SapoFactory(){
	this->setFactoryUtil(new FactoryUtil());
}

SapoFactory::~SapoFactory(void){
	delete(this->factoryUtil);
}

Element* SapoFactory::createElement( XMLElement* element) {
	return this->cretaeSapo(element);
}

FactoryUtil* SapoFactory::getFactoryUtil(){
	return this->factoryUtil;
}

void SapoFactory::setFactoryUtil(FactoryUtil* factoryUtil){
	this->factoryUtil = factoryUtil;
}

Sapo* SapoFactory::cretaeSapo(XMLElement* element){
	
	Sapo* sapo = new Sapo();
	
	string id = this->factoryUtil->buildId(element);
	Position *position = this->getFactoryUtil()->buildSapoPosition(element);
	float radius = this->getFactoryUtil()->buildSapoRadius(element);
	//Texture* texture = this->getFactoryUtil()->buildSapoTexture(element);
	Color* color = this->getFactoryUtil()->buildSapoColor(element);
	
	sapo->setId(id);
	sapo->setPosition(position);
	sapo->setRadius(radius);
	//sapo->setTexture(texture);
	sapo->setElementColor(color->getRGB());
	
	return sapo;
}